package A01Mangner;

import java.util.Scanner;

public class study{
    public static human getIn(String name, int age, int id){
        human h = new human();
        h.setName(name);
        h.setAge(age);
        h.setId(id);
        return h;
    }
    public static void printIn(human[] h){
        for(int i=0;i<h.length;i++){
            human h1 = h[i];
            if(h[i]!=null) {
                System.out.println(h1.getName() + " " + h1.getAge() + " " + h1.getId());
            }
        }
    }
    public static void detele(int id,human[] h){
        for(int i=0;i<h.length;i++){
            human h1 = h[i];
            if(h1.getId()==id){
                h[i]=null;
                return;
            }
        }
        System.out.println("No such element");
    }
    public static void main(String[] args) {
        human[] peopele=new human[3];
        peopele[0]=getIn("一号",19,1);
        peopele[1]=getIn("二号",18,2);
        peopele[2]=null;//getIn("三号",20,3);
        Scanner sc=new Scanner(System.in);
        String name=sc.next();
        int age=sc.nextInt();
        int id=sc.nextInt();
        int tempIdCount=0;
        for(int i=0;i<peopele.length;i++){
            human p=peopele[i];
            if(p!=null) {
                if (p.getId() == id) {
                    tempIdCount++;
                }
            }
        }
        if(tempIdCount>0){
                System.out.println("id重复了");
        }
        else{
                int temp=0;
                for(int j=0;j<peopele.length;j++) {
                    if (peopele[j] != null) {
                        temp++;
                    }
                }
                if(temp<peopele.length){
                        peopele[temp]=getIn(name,age,id);
                        printIn(peopele);
                }
                else{
                        human[] people=new human[peopele.length+1];
                        for(int k=0;k<peopele.length;k++){
                            people[k]=peopele[k];
                        }
                        people[peopele.length]=getIn(name,age,id);//这里是将旧数组覆盖到新数组
                        printIn(people);
                }
        }
        detele(4,peopele);
        printIn(peopele);
    }
}